﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin_AddPlane : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            try
            {
                AdminBAL _adminBAL = new AdminBAL();
                string Name = TextBox1.Text;
                int BusSeat = Convert.ToInt32(TextBox2.Text);
                int FirstSeat = Convert.ToInt32(TextBox3.Text);
                int ClubtSeat = Convert.ToInt32(TextBox4.Text);
                _adminBAL.AddPlane(Name, BusSeat, FirstSeat, ClubtSeat);
                Response.Redirect("~/Admin/PlaneList.aspx");
            }
            catch (Exception)
            {
                
                throw;
            }
        }
    }
    protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
    {
        try
        {
            int BusSeat = Convert.ToInt32(TextBox2.Text);
            int FirstSeat = Convert.ToInt32(TextBox3.Text);
            int ClubtSeat = Convert.ToInt32(TextBox4.Text);
            args.IsValid = true;
        }
        catch (Exception)
        {
            args.IsValid = false;
        }
    }
}
